package com.power.sifa.approve.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.core.base.model.Ha_attachment;
import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
*  表单绑定生成材料文件实体类
*/

@Entity
@ApiModel(value="表单绑定生成材料文件")
@Data
@Table(name="Aprv_materials_options",schema="sfapprove")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Builder
@AllArgsConstructor
//@IdClass(Aprv_materials_options.Aprv_materials_optionsPK.class) 用于复合组件
public class Aprv_materials_options extends BaseModel implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
    @Id
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "序号")
    private String id;

    @ApiModelProperty(value = "applyid")
    private String applyid;

    @ApiModelProperty(value = "材料类型")
    private Integer mattype;

    @ApiModelProperty(value = "材料id")
    private String materialid;

    @ApiModelProperty(value = "用户id")
    private String userid;

    @ApiModelProperty(value = "用户名称")
    private String username;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createtime;

    @ApiModelProperty(value = "入参表单")
    private String docfiled;

    @ApiModelProperty(value = "业务类型")
    private Integer proctype;


//    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "aprv_materials_options")
//    @SequenceGenerator(name = "aprv_materials_options", sequenceName = "APRV_MATERIALS_OPTIONS", allocationSize = 1)
    @ApiModelProperty(value = "版本号")
    private Integer version;

    @ApiModelProperty(value = "固定材料id")
    private String attachid;

    /**
     * 附件信息
     */
    @Transient
    private Ha_attachment file;

    /**
     *  材料类型文本
     */
    @Transient
    @FieldEnumText(eum="Tp_procmaterial", valuefield="mattype")
    private String mattype_text;


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("applyid", this.getApplyid());
        map.put("mattype_text", this.mattype_text);
        map.put("mattype", this.getMattype());
        map.put("materialid", this.getMaterialid());
        map.put("userid", this.getUserid());
        map.put("username", this.getUsername());
        map.put("createtime", this.getCreatetime());
        map.put("docfiled", this.getDocfiled());
        map.put("proctype", this.getProctype());
        map.put("version", this.getVersion());
        map.put("attachid", this.getAttachid());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Aprv_materials_optionsPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String)key;

        //Aprv_materials_optionsPK pk = (Aprv_materials_optionsPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}